//
//  NewsMasterCell.m
//  WanCaiC8
//
//  Created by tangang on 2018/7/19.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "NewsMasterCell.h"

@implementation NewsMasterCell{
    UIImageView    *imageV;
    QXLable        *labName;
    QXLable        *labFans;
}



- (instancetype)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        imageV =[[UIImageView alloc]init];
        imageV.layer.masksToBounds=YES;
        imageV.layer.cornerRadius=real_size(30);
        [self.contentView addSubview:imageV];
        [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(real_size(60), real_size(60)));
            make.centerX.equalTo(self);
            make.top.equalTo(self).with.offset(real_size(10));
        }];
        
        labName=[[QXLable alloc]init];
        labName.textAlignment=NSTextAlignmentCenter;
        [self.contentView addSubview:labName];
        [labName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(imageV);
            make.top.equalTo(imageV.mas_bottom).with.offset(real_size(10));
            make.left.right.equalTo(self.contentView);
        }];
        
        labFans=[[QXLable alloc]init];
        [self.contentView addSubview:labFans];
        [labFans mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(imageV);
            make.bottom.equalTo(self.contentView).with.offset(-10);
        }];
        
//        UIView *line=[[UIView alloc]init];
//        line.backgroundColor=DEFAULTBGCOLOR;
//        [self.contentView addSubview:line];
//        [line mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.bottom.equalTo(self.contentView);
//            make.height.mas_equalTo(@5);
//        }];
    }
    return self;
}

- (void)setModel:(ExpertsModel *)model{
    [imageV sd_setImageWithURL:[NSURL URLWithString:model.Avater]];
    labName.text=model.Name;
    NSMutableAttributedString *attStr=[[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"粉丝:%@",model.FansNumber]];
    [attStr addAttribute:NSForegroundColorAttributeName value:NAVCOLOR range:NSMakeRange(3, model.FansNumber.length)];
    labFans.attributedText=attStr;
}

@end
